%> Creates a bsub file to be executed at Lancaster HEC
%> @param Name of a class that has the "go" method
%> @param goname ='go' for a different function other than go()
function make_bsub(classname, goname)

if nargin < 2 || isempty(goname)
    goname = 'go';
end;

% '#BSUB -oo log_%s.log', '\n', ...

s = sprintf([ ...
'#BSUB -L /bin/bash', '\n', ...
'', '\n', ...
'#BSUB -J %s', '\n', ...
'#BSUB -oo /dev/null', '\n', ...
'#BSUB -eo err_%s.log', '\n', ...
'#BSUB -R ''rusage[mem=4095]''', '\n', ...
'#BSUB -N', '\n', ...
'#BSUB -u juliotrevisan@gmail.com', '\n', ...
'', '\n', ...
'. /etc/profile', '\n', ...
'module add matlab', '\n', ...
'', '\n', ...
'echo Job running on node `uname -n`', '\n', ...
'', '\n', ...
'echo "%s(''%s'', 1)" | matlab -singleCompThread', '\n'], ...
...
...
...
classname, ...
classname, ...
goname, ...
classname);



fn = sprintf('%s.bsub', classname);

h = fopen(fn, 'w');
fwrite(h, s);
fclose(h);

fprintf('Created file %s\n', fn);


